﻿<?php
	include( '../pub.php' ); 
	include( '../db.php' );
?>

<?php
echo "funBase.php"."<br />";

// 根据参数生成相应的 <select></select> 标签
function selectQuery( $s_class )
{
	//$s_query;
	$sql;
	echo '$s_class='.$s_class.'<br />';
	if ( $s_class != "" )
	{
		if ( $s_class == 'year' )
			{
				$sql = 'select * from t_'.$s_class;
				echo '$sql='.$sql.'<br />';
			}
		elseif ( $s_class == 'level' )
			{
				$sql = 'select * from t_'.$s_class;
				echo '$sql='.$sql.'<br />';
			}
		elseif( $s_class == 'class' )
			{
				$sql = 'select * from t_'.$s_class;
				echo '$sql='.$sql.'<br />';
			}
		elseif( $s_class == 'point' )
			{
				$sql = 'select * from t_'.$s_class;
				echo '$sql='.$sql.'<br />';
			}
		else
			{
				echo '#Error : funBase.php '.$s_class.'<br />';
			}
		// 处理查询请求
		//$sql = (string)$sql;
		//echo 'A:'.$sql.'<br />';
		//print($sql);
		//$len = strlen($sql);
		//echo '<br />strlen='.$len.'<br />';
		//echo $sql.get_resource_type();
		
		$data = mysql_query( $sql, $conn );
		
		while ( $arr = mysql_fetch_array($data) )
			{
				?>
				<select name="<?php $arr[$s_class]; ?>" >
					<option value="<?php $arr['t_'.$s_class]; ?>" > <?php $arr['t_'.$s_class]; ?> </option>
				</select>
				<?php
				//echo '111';
			}	
	}
	else
		{
			echo '$s_class Error! $s_class='.$s_class.'<br />';
		}
};

// 重定位 函数 相当于 header( Location: URL );
function redirect($url)
{
    if ($url != '')
	{    
        header('Location: '.$url); exit;
    }else
	{   
		// 支持js时使用js
        echo '<script type="text/javascript">';
        echo 'window.location.href="'.$url.'";';
        echo '</script>';
        echo '<noscript>';
        echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
        echo '</noscript>'; 
		exit;
    }
}

?>